Trò chơi Angry Birds trong UNITY Engine
31.671 lượt xem;
1 public static class GoEaseBack
2 {
3 public static float EaseIn( float t, float b, float c, float d )
4 {
5 return c * ( t /= d ) * t * ( ( 1.70158f + 1 ) * t - 1.70158f ) + b;
6 }
7
8
9 public static float EaseOut( float t, float b, float c, float d )
10 {
11 return c * ( ( t = t / d - 1 ) * t * ( ( 1.70158f + 1 ) * t + 1.70158f ) + 1 ) + b;
12 }
13
14
15 public static float EaseInOut( float t, float b, float c, float d )
16 {
17 float s = 1.70158f;
18 if( ( t /= d / 2 ) < 1 )
19 {
20 return c / 2 * ( t * t * ( ( ( s *= ( 1.525f ) ) + 1 ) * t - s ) ) + b;
21 }
22 return c / 2 * ( ( t -= 2 ) * t * ( ( ( s *= ( 1.525f ) ) + 1 ) * t + s ) + 2 ) + b;
23 }
24 }
2 {
3 public static float EaseIn( float t, float b, float c, float d )
4 {
5 return c * ( t /= d ) * t * ( ( 1.70158f + 1 ) * t - 1.70158f ) + b;
6 }
7
8
9 public static float EaseOut( float t, float b, float c, float d )
10 {
11 return c * ( ( t = t / d - 1 ) * t * ( ( 1.70158f + 1 ) * t + 1.70158f ) + 1 ) + b;
12 }
13
14
15 public static float EaseInOut( float t, float b, float c, float d )
16 {
17 float s = 1.70158f;
18 if( ( t /= d / 2 ) < 1 )
19 {
20 return c / 2 * ( t * t * ( ( ( s *= ( 1.525f ) ) + 1 ) * t - s ) ) + b;
21 }
22 return c / 2 * ( ( t -= 2 ) * t * ( ( ( s *= ( 1.525f ) ) + 1 ) * t + s ) + 2 ) + b;
23 }
24 }